﻿<!doctype html>
<html>
<!-- InstanceBegin template="/Templates/template1.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta charset="utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>详情页</title>
<!-- InstanceEndEditable -->

<script type="text/javascript" src="../js/common.js"></script>
<script type="text/javascript" src="../js/checkLogin.js"></script> 
<link href="../css/Pager.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../js/jquery.pager.js"></script>
<script type="text/javascript" src="../js/gbRst.js"></script>
<script type="text/javascript" src="../js/doubleDate2.0.js"></script>
	<script type="text/javascript" src="../js/utils.js"></script>
	<link href="../css/style.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../js/ac_quicktime.js"></script>
<script type="text/javascript" src="../js/amrAudioPlayer.js"></script>
<link href="shadowbox/shadowbox.css" rel="stylesheet" />
	<script type="text/javascript" src="shadowbox/shadowbox.js"></script>
<script type="text/javascript">
var _complaintId= 0;
$(function(){
	_complaintId=getIdByName("id");
	getComplainById();
	initImage();
})


			function initImage() {
				Shadowbox.init();
				window.openImage = function(url) {
					Shadowbox.open({
						content : url,
						player : 'img'
					});
				};
			}

function getComplainById(){
	if(_complaintId==0){
		art.dialog({fixed:true, lock: true,content:"页面出错",icon:'error',ok:true});
		return false;
	}
	$.ajax({
		type : "get",
		async:false,
		datatype : "json",
		url : "../complnt/find/complaintById/id/"+_complaintId,
		success : function(data) {
			var rst = JSON.parse(data);
			 if(IsEmpty(rst)){
					art.dialog({fixed:true, lock: true,content:"查询出错",icon:'error',ok:true});	
					return false;
					}
					if(rst.state==0){
					if(rst.result.len==0){
						art.dialog({fixed:true, lock: true,content:"该条数据不存在",icon:'error',ok:true});	
						return false;	
					}else{
						$("#billFrom").val(getHtmlString(getHeadIndexValue(0, rst, "billFrom")));
						$("#cmpltDate").val(getHtmlString(getHeadIndexValue(0, rst, "cmpltDate")));
						$("#cmpltTypeName").val(getHtmlString(getHeadIndexValue(0, rst, "cmpltTypeName")));
						$("#staName").val(getHtmlString(getHeadIndexValue(0, rst, "staName")));
						$("#title").val(getHtmlString(getHeadIndexValue(0, rst, "title")));
						$("#content").text(getHtmlString(getHeadIndexValue(0, rst, "content")));
						$("#custName").val(getHtmlString(getHeadIndexValue(0, rst, "custName")));
						$("#phone").val(getHtmlString(getHeadIndexValue(0, rst, "phone")));
						_imageUrl= getHtmlString(getHeadIndexValue(0, rst, "imageUrl"));
						_voidUrl=getHtmlString(getHeadIndexValue(0, rst, "voiceUrl"));
						if(IsEmpty(_imageUrl)){
						$("#imageShow").hide()
						}
						if(IsEmpty(_voidUrl)){
							$("#voiceShow").hide()
						}
						
						var status=	getHtmlInt(getHeadIndexValue(0, rst, "status"));
						if(status==2){
							var satis =getHtmlString(getHeadIndexValue(0, rst, "satis"))
							var evaluationContent =getHtmlString(getHeadIndexValue(0, rst, "evaContent"))
							var evaDate =getHtmlString(getHeadIndexValue(0, rst, "evaDate"))
							$("#satis").val(satis)
							$("#evaluationContent").val(evaluationContent)
							$("#evaDate").val(evaDate)
							$("#qj").show();
							$("#timeShow").show()
							$("#cl_btn").hide()
							$("#qj_btn").hide()
							if(IsEmpty(evaDate)){
								$("#timeShow").hide()
								$("#qj_btn").show()
							}
						}else{
							$("#cl_btn").show()
						}

					}	
					}else if(rst.state==1){
						art.dialog({fixed:true, lock: true,content:rst.msg,icon:'error',ok:true});	
					}else{
						checkStateShowErrorMsgAndDealResult(data);
					}
		}
	});
}

function toSave(){
	var evaluationContent = $("#evaluationContent").val();
	if(IsEmpty(evaluationContent)){
		art.dialog({fixed:true, lock: true,content:"请填写评价内容",icon:'error',ok:true});
		return false;
	}else{
		if(evaluationContent.length>255){
			art.dialog({fixed:true, lock: true,content:"评价过长",icon:'error',ok:true});
			return false;	
		}
	}
	var satis = $("#satis").val()
	
	var heads=new Array("evaContent","satis","id");
	var datas=new Array(evaluationContent,satis,_complaintId);
	var parser = new Object();
	var jsonParserStr = null;
	if (IsNotEmpty(datas)){
		addToParser(heads, datas, "edit" , parser);
		jsonParserStr =  JSON.stringify(parser);
	}
	
	$.post("../complnt/edit/evaluationContent",{"data":jsonParserStr}, function(data) {
		var dt = JSON.parse(data);	
				 if(IsEmpty(dt)){
						art.dialog({fixed:true, lock: true,content:"评价出错",icon:'error',ok:true});	
				return false;
				}
				if(dt.state==0){
				art.dialog({fixed:true, lock: true,content:"评价成功",icon:'succeed',ok:function(){getComplainById()}});	
				}else if(dt.state==1){
					art.dialog({fixed:true, lock: true,content:dt.msg,icon:'error',ok:true});
				}else{
					checkStateShowErrorMsgAndDealResult(data);
				}
		
	});
}
function toSaveS(){	
	var heads=new Array("status","id");
	var datas=new Array("2",_complaintId);
	var parser = new Object();
	var jsonParserStr = null;
	if (IsNotEmpty(datas)){
		addToParser(heads, datas, "edit" , parser);
		jsonParserStr =  JSON.stringify(parser);
	}
	
	$.post("../complnt/edit/editStatus",{"data":jsonParserStr}, function(data) {
		var dt = JSON.parse(data);	
				 if(IsEmpty(dt)){
						art.dialog({fixed:true, lock: true,content:"处理出错",icon:'error',ok:true});	
				return false;
				}
				if(dt.state==0){
				art.dialog({fixed:true, lock: true,content:"处理成功",icon:'succeed',ok:function(){getComplainById()}});	
				}else if(dt.state==1){
					art.dialog({fixed:true, lock: true,content:dt.msg,icon:'error',ok:true});
				}else{
					checkStateShowErrorMsgAndDealResult(data);
				}
		
	});
}
function openImageUrl(){
	openImage(_imageUrl);
}
function openVoide(){
	amrAudioPlay(_voidUrl,'amr4')
	}
function returnURL(){
	window.location.href='complain.html?cusName='+getIdByName("cusName")+"&flag=2&dtBegin="+getIdByName("dtBegin")+"&dtEnd="+getIdByName("dtEnd")+"&status="+getIdByName("status")+"&pageIndex="+getIdByName("pageIndex")
}	
</script>


</head>

<body>
<!-- InstanceBeginEditable name="EditRegion3" --> 


<div class="container" id="container">
  <div class="container_R fr">
      <div class="place"><a onclick='returnURL()' href='javaScript:void(0)'>投诉建议</a><span> &gt; <span>详情<a class="goHome" onclick='returnURL()' href='javaScript:void(0)'>返回</a></div>
    <div class="member_search publish"  style="padding:0;">
    	<div class="knowPerson">
      <p class="knowAll">
        <label> <span>来源：</span>
          <input type="text" readonly id="billFrom">
        </label>
        
        <label> <span>时间：</span>
          <input type="text" id="cmpltDate" readonly="readonly">
        </label>
        </p>
        <p  class="knowAll">
        <label> <span>类型：</span>
          <input type="text" readonly id="cmpltTypeName">
        </label>
         <label> <span>状态：</span>
          <input type="text" readonly id="staName">
        </label>
        </p>
      </div>
      	<p>
      	
      	<div class="knowPerson">
      <p class="knowAll">
        <label> <span>主题：</span>
          <input type="text" readonly id="title" style="width: 200px;">
        </label>
        <label id="imageShow"><span> </span><a onclick="openImageUrl()" style="text-decoration:underline; color: green;" href="###">查看图片</a>
        </label>
        <label id="voiceShow"> <span> </span>
        <a id="amr4" onclick="openVoide()" href="###">

    <font style="text-decoration:underline; color: green;">播放</font>

</a>
        </label>
        </p>
        <p class="knowAll">
        <label> <span>内容：</span>
          <textarea  readonly id="content" style="width: 400px;height: 50px;"></textarea>
        </label>
       
        </p>
      </div>
      <p>
      	<div class="knowPerson">
      <p class="knowAll">
        <label> <span>提交人姓名或昵称：</span>
          <input type="text" readonly id="custName">
        </label>
        <label> <span>联系方式：</span>
          <input type="text" readonly id="phone">
        </label>
        <label> 
        </label>
        </p>
      </div>
      <p>
       <form id="qj" style="display: none;" name="fm1" action="#" target="post">
            <p class="knowAll">
             
        <label><span>满意度：</span>
            <select id="satis" >
            <option value="满意">满意</option>
            <option value="一般">一般</option>
            <option value="不满意">不满意</option>
            </select>
            </label>
            <label id="timeShow" > <span>评价时间：</span>
          <input type="text" readonly id="evaDate">
        </label>
           </p>
           <p><label><span>评价内容：</span>&nbsp;<textarea class="isDisabled" id="evaluationContent"></textarea></label>
           </p>   
        </form>
        <div class="BottomBtn">
            <input id="qj_btn" style="display: none;" type="button" value="评价" onclick="toSave()">      
            <input id="cl_btn"  style="display: none;" type="button" value="已处理" onclick="toSaveS()">      
            </div>
       </div>  
  </div>
    <div class="fc"></div>
  
</div>
<!-- InstanceEndEditable --> 
<script type="text/javascript" src="../js/header.js"></script> 
<script type="text/javascript" src="../js/left.js"></script> 
<script type="text/javascript" src="../js/footer.js"></script> 
<script type="text/javascript">
clearThis("absoluteTxt");
showTab(4, 9);
</script>
</body>
<!-- InstanceEnd -->
</html>
